/**
 * 
 */
package com.block.common.security.service.factory;


import com.block.common.security.service.AppEncryptMannerService;
import com.block.common.security.service.impl.AESEncryptManner;
import com.block.common.security.service.impl.AESIVEncryptManager;
import com.block.common.security.service.impl.Base64EncryptManner;

import java.util.HashMap;
import java.util.Map;


/**
 * 
 * app数据加密方式工厂
 */
public class AppEncryptFactory {
	/**
	 * base64
	 */
	public static final String BASE64 = "01";
	/**
	 * AES
	 */
	public static final String AES = "02";

	public static final String AES2="DEFAULT";

	//是否加密
	/**
	 * 加密
	 */
	public static final String IS_ENCRYPT = "1";

	/**
	 * 加密方式处理MAP
	 */
	private static Map<String, AppEncryptMannerService> encryptMannerMap = null;
	static 
	{
		encryptMannerMap = new HashMap<String, AppEncryptMannerService>();
		encryptMannerMap.put(BASE64, new Base64EncryptManner());
		encryptMannerMap.put(AES, new AESIVEncryptManager());
		encryptMannerMap.put(AES2,new AESEncryptManner());
	}
	
	/**
	 * 获得【app加密方式处理】
	 * @param type
	 * @return
	 */
	public static AppEncryptMannerService getAppEncryptManner(String type)
	{
		return encryptMannerMap.get(type);
	}
}
